<?php
class Control_Game_getServers {

	function getServers() {
		$game = MooForm::request('game');
		$game = MooObj::get('Game')->transportGame($game);
		$platform = MooForm::request('platform');
		$gameinfoConf = MooObj::get('Game')->getGameConf();
		
		$serverNum = $gameinfoConf[$game]['serverNum'][$platform];
		$pageNums  = 5;
		
		$pages = $serverNum / $pageNums;
		$yushu = $serverNum % $pageNums;
		if ($yushu > 0) {
			$pages = $pages + 1;
		}
		
		$pageNameArr = array();
		for($i = 1; $i <= $pages; $i ++) {
			$minServer = (($i-1)  * $pageNums + 1);
			$maxServer = $i * $pageNums;
			if($maxServer > $serverNum) {
				$maxServer = $serverNum;
			}
			$pageName = $minServer . "-" . 	$maxServer;
			$pageNameArr['servers'][] = $pageName;
		}
		exit(MooJson::encode($pageNameArr));
	}
}